﻿using System;
using System.Collections.Generic;

namespace base31.Services.Hub.Models
{
    /// <summary>
    /// Represents a feed entry that has been seen.
    /// The key name of this entity is a GetHashKeyName() hash of the entry_id.
    /// </summary>
    public class FeedEntryRecord
    {
        public string EntryContentHash { get; set; }
        public DateTime UpdateTime { get; set; }

        /// <summary>
        /// Returns the sha1 hash of the entry ID.
        /// </summary>
        /// <param name="entryId"></param>
        /// <returns></returns>
        public string IdHash(string entryId)
        {
            return "";
        }

        /// <summary>
        /// Creates a new Key for a FeedEntryRecord entity.
        /// </summary>
        /// <param name="topic">The topic URL to retrieve entries for.</param>
        /// <param name="entryId">String containing the entry_id.</param>
        /// <returns>Key instance for this FeedEntryRecord.</returns>
        public string CreateKey(string topic,
                                string entryId)
        {
            return "";
        }

        /// <summary>
        /// Gets multiple FeedEntryRecord entities for a topic by their entry_ids.
        /// </summary>
        /// <param name="topic">The topic URL to retrieve entries for.</param>
        /// <param name="entryIds">Sequence of entry_ids to retrieve.</param>
        /// <returns>List of FeedEntryRecords that were found, if any.</returns>
        public List<FeedEntryRecord> GetEntriesForTopic(string topic,
                                                        List<string> entryIds)
        {
            return null;
        }

        /// <summary>
        /// Creates multiple FeedEntryRecords entities for a topic.
        /// Does not actually insert the entities into the Datastore. This is left to
        /// the caller so they can do it as part of a larger batch put().
        /// </summary>
        /// <param name="topic">The topic URL to insert entities for.</param>
        /// <param name="entryId">String containing the ID of the entry.</param>
        /// <param name="contentHash">Sha1 hash of the entry's entire XML content. For example,
        /// with Atom this would apply to everything from <entry> to </entry> with
        /// the surrounding tags included. With RSS it would be everything from
        /// <item> to </item>.</param>
        /// <returns>A new FeedEntryRecord that should be inserted into the Datastore.</returns>
        public FeedEntryRecord CreateEntryForTopic(string topic,
                                                   string entryId,
                                                   string contentHash)
        {
            return null;
        }
    }
}